package com.susallwave.srcb.schedule;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component("syncPbocChart")
public class SyncPbocChart extends RetryDistributedLock{
    private int runCount = 0;

    @Override
    protected String taskName() {
        return "syncPbocChart";
    }

    @Override
    protected void doBusiness() throws Exception {
        runCount++;
        Thread.sleep(5000);
        log.info("【TestTask】第 {} 次执行", runCount);
        if (runCount < 3) {
            throw new Exception("故意失败，触发重试"+runCount);
        }
        log.info("【TestTask】执行成功");
    }
}
